home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicTextPaneUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.3 KB  |  60 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.beans.PropertyChangeEvent;
  6. import javax.swing.JComponent;
  7. import javax.swing.JEditorPane;
  8. import javax.swing.plaf.ComponentUI;
  9. import javax.swing.text.EditorKit;
  10. import javax.swing.text.JTextComponent;
  11. import javax.swing.text.Style;
  12. import javax.swing.text.StyleConstants;
  13. import javax.swing.text.StyledDocument;
  14.  
  15. public class BasicTextPaneUI extends BasicEditorPaneUI {
  16.    public static ComponentUI createUI(JComponent var0) {
  17.       return new BasicTextPaneUI();
  18.    }
  19.  
  20.    public EditorKit getEditorKit(JTextComponent var1) {
  21.       JEditorPane var2 = (JEditorPane)((BasicTextUI)this).getComponent();
  22.       return var2.getEditorKit();
  23.    }
  24.  
  25.    protected String getPropertyPrefix() {
  26.       return "TextPane";
  27.    }
  28.  
  29.    protected void propertyChange(PropertyChangeEvent var1) {
  30.       super.propertyChange(var1);
  31.       StyledDocument var2 = (StyledDocument)((BasicTextUI)this).getComponent().getDocument();
  32.       Style var3 = var2.getStyle("default");
  33.       if (var3 != null) {
  34.          String var4 = var1.getPropertyName();
  35.          if (var4.equals("foreground")) {
  36.             Color var5 = (Color)var1.getNewValue();
  37.             if (var5 != null) {
  38.                StyleConstants.setForeground(var3, var5);
  39.             } else {
  40.                var3.removeAttribute(StyleConstants.Foreground);
  41.             }
  42.          } else if (var4.equals("font")) {
  43.             Font var6 = (Font)var1.getNewValue();
  44.             if (var6 != null) {
  45.                StyleConstants.setFontFamily(var3, var6.getName());
  46.                StyleConstants.setFontSize(var3, var6.getSize());
  47.                StyleConstants.setBold(var3, var6.isBold());
  48.                StyleConstants.setItalic(var3, var6.isItalic());
  49.             } else {
  50.                var3.removeAttribute(StyleConstants.FontFamily);
  51.                var3.removeAttribute(StyleConstants.FontSize);
  52.                var3.removeAttribute(StyleConstants.Bold);
  53.                var3.removeAttribute(StyleConstants.Italic);
  54.             }
  55.          }
  56.  
  57.       }
  58.    }
  59. }
  60.